import Foundation

func printHelp() {
    print("VDH (Video Downloader Helper) v2.0.0")
    print("Unix Socket-based video downloader with SQLite database and queue management")
    print("")
    print("USAGE:")
    print("  vdh [COMMAND] [OPTIONS]")
    print("")
    print("COMMANDS:")
    print("  start                      Start VDH server in background")
    print("  stop                       Stop running VDH server")
    print("  status                     Check VDH server and queue status")
    print("  server                     Start Unix socket server (foreground)")
    print("  download <URL>, -d <URL>   Download single video directly")
    print("  input <URL>, -i <URL>      Send download request to running server")
    print("  task <ID>                  Get details for specific task ID")
    print("  list, ls                   List recent tasks")
    print("  stats                      Show task statistics")
    print("  config [show|edit|reload|reset] Manage configuration")
    print("  cleanup                    Remove old completed tasks (30+ days)")
    print("  test                       Test socket communication")
    print("  help, --help, -h           Show this help message")
    print("  version, --version, -v     Show version information")
    print("")
    print("DATABASE FEATURES:")
    print("  • Persistent task storage with SQLite3")
    print("  • Task status tracking (queued/downloading/completed/failed)")
    print("  • Automatic task recovery on server restart")
    print("  • Task ID management for easy reference")
    print("  • File path recording for completed downloads")
    print("")
    print("QUEUE MANAGEMENT:")
    print("  • Max concurrent downloads: 2 (configurable)")
    print("  • Additional requests will be queued")
    print("  • Downloads process in FIFO order")
    print("  • Real-time status monitoring")
    print("")
    print("EXAMPLES:")
    print("  # Start the server in background")
    print("  vdh start")
    print("")
    print("  # Check server status")
    print("  vdh status")
    print("")
    print("  # Send download requests (returns task ID)")
    print("  vdh input 'https://youtube.com/watch?v=abc123'")
    print("  vdh -i 'https://youtube.com/watch?v=def456'")
    print("")
    print("  # Check specific task status")
    print("  vdh task abc123def456")
    print("")
    print("  # List recent tasks")
    print("  vdh list")
    print("")
    print("  # Check statistics")
    print("  vdh stats")
    print("")
    print("  # Stop the server")
    print("  vdh stop")
    print("")
    print("  # Configuration management")
    print("  vdh config show           # Show current settings")
    print("  vdh config edit           # Edit config file")
    print("  vdh config reload         # Reload after editing")
    print("")
    print("  # Direct download (skip queue)")
    print("  vdh -d 'https://youtube.com/watch?v=ghi789'")
    print("")
    print("  # Cleanup old tasks")
    print("  vdh cleanup")
    print("")
    print("HOMEBREW INTEGRATION:")
    print("  # Install via Homebrew")
    print("  brew install vdh")
    print("")
    print("  # Start as background service")
    print("  brew services start vdh")
    print("")
    print("  # Check service status")
    print("  brew services list | grep vdh")
    print("")
    print("CONFIGURATION:")
    print("  Config file: ~/.vdh/config.yaml")
    print("  Database:    ~/.vdh/video_downloader.db")
    print("  Temp files:  ~/.vdh/temp/")
    print("  Default output: ~/Downloads/VideoDownloader/")
    print("")
    print("For more information, visit: https://github.com/yourusername/vdh")
}